package edu.gatech.cs2340.mule.view;

import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import edu.gatech.cs2340.mule.model.Player;
import edu.gatech.cs2340.mule.presenter.MuleGamePresenter;

/**
 * Represents a display to the user of current round in the game
 * and the amount of time the player has left in his/her turn.
 * 
 * @author Zach Elliott
 *
 */
public class BannerPanel extends JPanel {
	
	private JLabel lblRound, lblPlayer, lblTime;
	
	/**
	 * 
	 * 
	 */
	public BannerPanel() {
		setLayout(new GridLayout(1,3));
		setBackground(MuleGamePresenter.BACKGROUND_COLOR);
		
		lblRound = new JLabel("<html><font size=+3><i>Land Selection");
		lblRound.setForeground(MuleGamePresenter.FOREGROUND_COLOR);
		lblRound.setBackground(MuleGamePresenter.BACKGROUND_COLOR);
		lblRound.setHorizontalAlignment(SwingConstants.CENTER);
		add(lblRound);
		
		lblPlayer = new JLabel();
		lblPlayer.setForeground(MuleGamePresenter.FOREGROUND_COLOR);
		lblPlayer.setBackground(MuleGamePresenter.BACKGROUND_COLOR);
		lblPlayer.setHorizontalAlignment(SwingConstants.CENTER);
		add(lblPlayer);
		
		lblTime = new JLabel("<html><font size=+3><i>Time Left: 50");
		lblTime.setForeground(MuleGamePresenter.FOREGROUND_COLOR);
		lblTime.setBackground(MuleGamePresenter.BACKGROUND_COLOR);
		lblTime.setHorizontalAlignment(SwingConstants.CENTER);
		add(lblTime);
	}
	
	/**
	 * Updates the time label to display the current time left in the player's turn
	 * 
	 * @param time The time the player has left in his/her turn
	 */
	public void updateTimeLabel(int time) {
		lblTime.setText("<html><font size=+3><i>Time Left: " +  time);
	}
	
	/**
	 * Updates the current player label
	 * 
	 * @param currentPlayer The current player in the game
	 */
	public void updatePlayerLabel(Player currentPlayer) {
		lblPlayer.setText("<html><font size=+3><i>" + currentPlayer.getPlayerName());
	}
	
	/**
	 * Updates the current round label
	 * 
	 * @param round The current round of the game
	 */
	public void updateRoundLabel(int round) {
		lblRound.setText("<html><font size=+3><i>Round " + round);
	}
	
	/**
	 * Initializes the round label for the first round of gameplay
	 * 
	 */
	public void addRoundLabel() {
		lblRound.setText("<html><font size=+3><i>Round 1");
	}
}
